class Solution {
public:
    vector<string> ret;
    void dfs(string s, int pos)
    {
        while(pos < s.size() && !isalpha(s[pos])) pos++;
        if(pos == s.size())
        {
            ret.push_back(s);
            return;
        }
        s[pos] = tolower(s[pos]);
        dfs(s, pos + 1);
        s[pos] = toupper(s[pos]);
        dfs(s, pos + 1);
    }
    vector<string> letterCasePermutation(string s) {
        dfs(s, 0);
        return ret;
    }
};